<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>数组</title>
</head>
<body>

</body>
<script>
    // 定义数组
    let arr = [10,20,30];
    arr[3] = 40; // js中的数组长度可变
    // 遍历
    for (let i = 0; i <= arr.length; i++) {
        document.write(arr[i] + "<br>");
    }

    // 数组高级运算符 ...
    // 复制数组
    let arr2 = [...arr];
    // 遍历
    for (let i = 0; i <= arr2.length; i++) {
        document.write(arr2[i] + "<br>");
    }

    // 合并数组
    let arr3 = [50,60];
    let arr4 = [...arr2,...arr3];
    // 遍历
    for (let i = 0; i <= arr4.length; i++) {
        document.write(arr4[i] + "<br>");
    }

    // 将字符串转成数组
    let arr5 =[..."itheima"];
    // 遍历
    for (let i = 0; i <= arr5.length; i++) {
        document.write(arr5[i] + "<br>");
    }
</script>
</html>